<template>
  <div style="overflow-x: hidden;">
    <view>
      <swiper2 :images="img2" :Height="Height"/>
    </view>
    <div class="pgtitle2" style="padding-left: 0;">
      {{list.name}}
    </div>
    <div class="youdian" >
       <div class="cont">
         <img :src="dunpaiimg" alt="" class="img" mode="widthFix"/>
         <span class="word">产品详情</span>
       </div>
<!--      <div class="cont">-->
<!--        <img :src="dunpaiimg" alt="" class="img" mode="widthFix"/>-->
<!--        <span class="word">免费安装</span>-->
<!--      </div>-->
<!--      <div class="cont">-->
<!--        <img :src="dunpaiimg" alt="" class="img" mode="widthFix"/>-->
<!--        <span class="word">正品保证</span>-->
<!--      </div>-->
    </div>
    <div style="width: 90%;margin:20px auto 100px;">
    <div class="content" v-html="list.info">
    </div>
    </div>
    <div class="fixbutton">
      <div class="more kefu" @click="contactjump">
        <img :src="fixbutton1" alt="" class="img" mode="widthFix"/>
        <div class="tit">联系客服</div>
      </div>
      <div class="more chanp" @click="projump">
        <img :src="fixbutton2" alt="" class="img" mode="widthFix"/>
        <div class="tit">产品中心</div>
      </div>
    </div>
  </div>
</template>


<script>
  import swiper2 from "@/components/swiper2";
  export default{
    components: { swiper2 },
    data(){
      return{
        list:[],
        img2: [],
        dunpaiimg:[
          "../../static/images/dunpai.png"
        ],
        fixbutton1:[
          "../../static/tabs/fixbutton1.png"
        ],
        fixbutton2:[
          "../../static/tabs/pro.png"
        ],
        Height:"",
      }
    },
    methods:{
      requestData(fcateid){
        var that=this;
        // console.log(that);
        var api='https://eztw.com.cn/appview/'+fcateid;
        wx.request({
          url: api,
          header: {
            'content-type': 'application/json' // 默认值
          },
          success: function(res) {
            wx.hideNavigationBarLoading()
            console.log(res)
            var htmlContent = res.data.info
            // console.log('htmlContent')

            res.data.info = htmlContent.replace(/(\<img|\<p)/gi, function ($0, $1) {
              return {
                '<img': '<img style="max-width:100%; display:inherit;height:auto" ',
                '<p': '<p style="margin-bottom: 0px;" ',
              }[$1]
            })

            that.list=res.data;
            wx.setNavigationBarTitle({title: res.data.name})
            var img2 =res.data['img2'].split(",");
            console.log(img2)
            that.img2=img2
          }
        })
      },
      contactjump(){
        wx.switchTab({
          url: '/pages/contact/main'
        })
      },
      projump(){
        wx.switchTab({
          url: '/pages/pro/main'
        })
      },
      imgHeight:function(e){
        var winWid = wx.getSystemInfoSync().windowWidth;
        var imgh=700;//图片高度
        var imgw=700;//图片宽度
        var swiperH=winWid*imgh/imgw + "px"
        this.Height=swiperH;
        console.log(this.Height);
      }
    },
    onLoad: function(options) {
      var id=options.id;
      this.requestData(id);
      wx.showNavigationBarLoading();
      this.imgHeight();
    },
    onShow(){
    }
  }
</script>

<style>
  .youdian {
    display: -webkit-flex;
    display: flex;
    flex-wrap:wrap;
    /*padding:10px 0 10px;*/
    width:100%;
    border-bottom: 1px solid #ddd;
  }
  .youdian .cont{
    width: 33.33333%;
    display: -webkit-flex;
    margin: 20px 0;
    display: flex;
    align-items:center;
  }
  .youdian .cont  .img{
    width: 25px;
    padding-left: 20px;
    margin-right: 10px;
    display: inline-block;
  }
  .youdian .cont .word{
    font-size: 14px;
    color: #333;
    margin-top: 3px;
  }
  .fixbutton{
    width: 100%;
    height: 50px;
    line-height: 50px;
    position: fixed;
    left: 0;
    bottom: 0;
    z-index:99;
    border-top: 1px solid #ddd;
    display: -webkit-flex;
    display: flex;
    flex-wrap:wrap;
  }
  .fixbutton .more{
    display: -webkit-flex;
    display: flex;
    align-items:center;
    flex-direction:column;
    width: 50%;
    font-size: 16px;
    text-align: center;
  }
  .fixbutton .kefu{
    background: #005bac;
    color: #ffffff;
  }
  .fixbutton .more .img{
    width: 30px;
    margin: 0 auto;
  }
  .fixbutton .more .tit{
    color: #ffffff;
    font-size: 12px;
    line-height: 15px;
  }
  .fixbutton .chanp{
    background: #fff;
  }
  .fixbutton .chanp .tit{
    color: #000;
  }
  .small{
    font-size: 14px;
    color: #bfbdbd;
    margin-top: 10px;
    margin-bottom: 10px;
    text-align: center;
  }
  .text-center{
    text-align: center;
  }
  .proimg{
    width:50%;
    display: inline-block;
    margin:0 auto;
  }
  /*底部*/
  .ft {
    padding: 10px 0 0 0;
    width: 100%;
    position: fixed;
    left: 0;
    bottom: 0;
  }
  .ft ul {
    height: 0px;margin: 0;padding: 0;
  }
  .ft ul li {
    float: left;
    width: 50%;
    height: 50px;
    text-align: center;
    list-style-type: none;
    margin: 0px;
    padding: 0px;
  }
  .ft ul li span {
    display: block;
    color: #fff;
    font-size: 1em;
    font-family: "微软雅黑";
    line-height: 22px;
  }
  .ft a {
    color: #000;
    text-decoration: none;
  }

</style>
